import java.util.ArrayList;
import java.util.List;

/**
 * @author: yangwk
 * @date: 2023/7/28
 * @description:
 **/
public class 水仙花数 {
    public static void main(String[] args) {
        printFlower(1000);
    }

    private static void printFlower(int val) {
        for (int i = val; i > 10; i--) {
            int num=i;
            List<Integer> integerList = new ArrayList<>();
            while (num != 0) {
                int i1 = num % 10;
                integerList.add(i1);
                num = num / 10;
            }

            for (int j = 1; j < i; j++) {
                int sum = 0;
                for (Integer integer : integerList) {
                    sum += Math.pow(integer, j);
                }
                if (sum == i) {
                    System.out.println(i);
                    break;
                }
            }

        }
    }
}
